From dc754cdd46bf89506ccbacd9e1edf4f18319ba6f Mon Sep 17 00:00:00 2001 From: Jon Nordby Date: Fri, 27 Jul 2012 22:00:46 +0200 Subject: [PATCH] Bug 673422 - Babl C type not accessible to introspection bindings https://bugzilla.gnome.org/show_bug.cgi?id=673422 Annotate Babl C type to be Babl.Object in GIR using the "rename to" annotation in GI 1.33.5+. For earlier versions, use a static .gir file to achieve the same. --- babl/Babl-0.1.gir.static | 457 +++++++++++++++++++++++++++++++++++++++ babl/Makefile.am | 11 + babl/babl-types.h | 7 +- configure.ac | 7 + 4 files changed, 480 insertions(+), 2 deletions(-) create mode 100644 babl/Babl-0.1.gir.static diff --git a/babl/Babl-0.1.gir.static b/babl/Babl-0.1.gir.static new file mode 100644 index 0000000..7481f62 --- /dev/null +++ b/babl/Babl-0.1.gir.static @@ -0,0 +1,457 @@ + + + + + + The babl API is based around polymorphism and almost everything is +a Babl object. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/babl/Makefile.am b/babl/Makefile.am index 03115a3..d5cf950 100644 --- a/babl/Makefile.am +++ b/babl/Makefile.am @@ -93,6 +93,8 @@ INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir) if HAVE_INTROSPECTION + +if HAVE_GI_RENAME_TO Babl-$(BABL_API_VERSION).gir: $(G_IR_SCANNER) $(library_include_HEADERS) $(c_sources) $(srcdir)/Makefile.am libbabl-@BABL_API_VERSION@.la $(INTROSPECTION_SCANNER) -v --namespace Babl --nsversion=$(BABL_API_VERSION) \ --add-include-path=$(srcdir) --add-include-path=. \ @@ -106,6 +108,15 @@ Babl-$(BABL_API_VERSION).gir: $(G_IR_SCANNER) $(library_include_HEADERS) $(c_sou $(addprefix $(builddir)/, $(libinc_generated_hdrs)) \ $(addprefix $(srcdir)/, $(c_sources)) +else # HAVE_GI_RENAME_TO +# If the "rename to" gobject introspection annotation is not respected (GI <= 1.33.4) +# we have to use a pre-generated .gir file. See https://bugzilla.gnome.org/show_bug.cgi?id=673422 +# and https://bugzilla.gnome.org/show_bug.cgi?id=675985 +Babl-$(BABL_API_VERSION).gir: + cp $@.static $@ + +endif # HAVE_GI_RENAME_TO + girdir = $(datadir)/gir-1.0 gir_DATA = Babl-$(BABL_API_VERSION).gir diff --git a/babl/babl-types.h b/babl/babl-types.h index 9729e04..62c0c4a 100644 --- a/babl/babl-types.h +++ b/babl/babl-types.h @@ -23,11 +23,14 @@ #error "babl-version.h must not be included directly, include babl.h instead." #endif - /** + * Babl: + * * The babl API is based around polymorphism and almost everything is * a Babl object. - */ + * + * Rename to: BablObject + **/ typedef union _Babl Babl; /* Conversion function between linear data of a either a data types or diff --git a/configure.ac b/configure.ac index 1bf9a71..12cc388 100644 --- a/configure.ac +++ b/configure.ac @@ -64,6 +64,13 @@ AC_SUBST(BABL_RELEASE) # GObject Introspection GOBJECT_INTROSPECTION_CHECK([0.10]) +# Check whether g-ir-scanner respects "rename to" annotation +PKG_CHECK_MODULES([GI_1_33_5], [gobject-introspection-1.0 >=1.33.5], + [have_gi_rename_to=true], + [have_gi_rename_to=false] +) +AM_CONDITIONAL(HAVE_GI_RENAME_TO, [test x$have_gi_rename_to = xtrue]) + # Vala AC_ARG_WITH(vala, [ --without-vala build without Vala support]) -- 2.30.2